package com.aaa.rent.controller.api;/**
 * Date:2023/3/1
 * Author：臣哥哥
 * Description:
 */


import com.aaa.entity.Brand;
import com.aaa.entity.CarTypeConfigDetails;
import com.aaa.rent.service.CarTypeConfigDetailsService;
import com.aaa.security.annotation.MyLog;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author     ：Xiaochen
 * @date       ：Created in 2023/3/1 16:33
 * @description：
 * @modified By：
 * @version:
 */
@Api(value = "/rent/api/carTypeConfigDetails", tags = {"车辆配置"})
@RestController
@RequestMapping("/rent/api/carTypeConfigDetails")
public class ApiCarTypeConfigDetailsController {
    @Autowired
    private CarTypeConfigDetailsService carTypeConfigDetailsService;


    /**
     * 模糊分页查询
     * @param currentPage
     * @param pageSize
     * @param carTypeConfigDetails
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "body", dataType = "CarTypeConfigDetails", name = "carTypeConfigDetails", value = "", required = true)
    })
    @ApiOperation(value = "模糊分页查询", notes = "模糊分页查询")
    @MyLog(title = "查询所有车辆配置")
    @RequestMapping("select")
    @ResponseBody
    public Result list(Integer currentPage, Integer pageSize, @RequestBody CarTypeConfigDetails carTypeConfigDetails){
        return carTypeConfigDetailsService.selectAll(currentPage,pageSize,carTypeConfigDetails);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "CarTypeConfigDetails", name = "carTypeConfigDetails", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @MyLog(title = "修改车辆配置")
    @PostMapping("update")
    public Result update(@RequestBody CarTypeConfigDetails carTypeConfigDetails){
        return carTypeConfigDetailsService.update(carTypeConfigDetails);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "CarTypeConfigDetails", name = "carTypeConfigDetails", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @MyLog(title = "添加车辆配置")
    @PostMapping("insert")
    public Result insert(@RequestBody CarTypeConfigDetails carTypeConfigDetails){
        return carTypeConfigDetailsService.insert(carTypeConfigDetails);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "id", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "GET")
    @MyLog(title = "删除车辆配置")
    @GetMapping("delete")
    public Result delete(Integer id){
        return carTypeConfigDetailsService.delete(id);
    }
}